package com.mtsmda.designPattern.main;

import com.mtsmda.designPattern.factory.Computer;
import com.mtsmda.designPattern.factory.ComputerFactory;
import com.mtsmda.designPattern.singleton.BillPughSingleton;
import com.mtsmda.designPattern.singleton.EagerInitializedSingleton;
import com.mtsmda.designPattern.singleton.LazyInitializedSingleton;
import com.mtsmda.designPattern.singleton.StaticBlockSingleton;
import com.mtsmda.designPattern.singleton.ThreadSafeDoubleCheckedLockingSingleton;
import com.mtsmda.designPattern.singleton.ThreadSafeSingleton;

public class Run {

	public static void main(String[] args) {
		/* Singleton */
		EagerInitializedSingleton eagerInitializedSingleton = EagerInitializedSingleton
				.getInstance();
		System.out.println(eagerInitializedSingleton != null);

		StaticBlockSingleton staticBlockSingleton = StaticBlockSingleton
				.getInstance();
		System.out.println(staticBlockSingleton != null);

		LazyInitializedSingleton lazyInitializedSingleton = LazyInitializedSingleton
				.getInstance();
		System.out.println(lazyInitializedSingleton != null);

		ThreadSafeSingleton threadSafeSingleton = ThreadSafeSingleton
				.getInstance();
		System.out.println(threadSafeSingleton != null);

		ThreadSafeDoubleCheckedLockingSingleton threadSafeDoubleCheckedLockingSingleton = ThreadSafeDoubleCheckedLockingSingleton
				.getInstance();
		System.out.println(threadSafeDoubleCheckedLockingSingleton != null);

		BillPughSingleton billPughSingleton = BillPughSingleton.getInstance();
		System.out.println(billPughSingleton != null);

		/* Factory */
		Computer pc = ComputerFactory.getComputer(ComputerFactory.PC,
				new String("500 Gb"), new String("8 Gb"),
				"Intel Pentium core i5 3.0 Ghz");
		Computer server = ComputerFactory.getComputer(ComputerFactory.SERVER,
				new String("2 Tb"), new String("16 Gb"), new String(
						"Intel Pentium core i7 extrime 4.0 Ghz"));
		System.out.println("PC - " + pc);
		System.out.println("Server - " + server);

	}

}